<?php use_helper('Date');?>
<?php use_javascript('/js/json_parse.js') ?>
<?php include_stylesheets_for_form($form) ?>
<?php include_javascripts_for_form($form) ?>
<?php 
$colibriParams = sfConfig::get('app_colibri_templates', false);
if($colibriParams){
	$templateParams = isset($colibriParams['processaction']) ? $colibriParams['processaction'] : false;
}else{
	$templateParams = false;
}
$backparams = 'dossier=' . $dossier->id ;
if($view){
	$backparams .= '&view='.$view;
}
if($order){
	$backparams .= '&order='.$order;
}
if($actualPage){
	$backparams .= '&page='.$actualPage;
}
if($actionRef){
	$backparams .= '&actionRef=' . $actionRef;
}
$backurl = $moduleRef . '/' . $actionRef . '?' . $backparams;
?>
<form id = "myForm" action="<?php echo url_for($moduleRef . '/submitAction?dossier=' . $dossier->id . '&' . $backparams ) ?>" method="post" enctype="multipart/form-data" tmt:validate = "true" tmt:callback="errorOnLabels" class="defaultForm">
  		 <fieldset>
                <legend>Confirmation de votre action: <?php echo $actionWf->description?></legend>
                <h1>Nom de l'action: <?php echo $actionWf->description?></h1>
                <?php if($actionWf->visibilite!=1):?>
                <h3><?php echo ('Cette action à une visibilité restreinte : ');
                	if($actionWf->visibilite==2)
                	{
                		echo ('Personnes internes au domaine ' . $demande->domaine->description);
                	}
                	elseif($actionWf->visibilite==3)
                	{
                		echo ("L'acteur actuel et le suivant ") . '<span id="NomValideur2">'. $nomValideur.'</span>';
                	}
                ?></h3>
                <?php endif;?>
                <?php if($templateParams && isset($templateParams['showButtonsTop']) && $templateParams['showButtonsTop']):?>
		        <div class="buttons">
		          &nbsp;<a href="<?php echo url_for($backurl) ?>"><img title="<?php echo __('Cancel')?>" src="/images/icons/48/back.png"></img></a>
		          <input name="Submit" title="<?php echo __('Apply')?>" type="image" src="/images/icons/48/confirm.png">
		        </div>      
		        <?php endif;?>          
          		<?php echo $form->renderHiddenFields()?>
          		<?php if(isset($commentaire)):?>
         		<?php echo '<h2>'.$commentaire.'</h2>';?>
         		<?php endif;?>
    	 <fieldset><legend>Commentaires</legend>
    	<div id="wrapper_commentaire">
	     	<?php echo $form['commentaire']->renderLabel() ?>
	     	<br />
			<?php echo $form['commentaire']->render() ?>
			<?php echo $form['commentaire']->renderHelp() ?>
		</div>

		<?php 
		//Champs à modifier
      	// echo $form->renderFieldsToModify();
      	
      	
      	if ($showActeurs){
      		echo $form['acteur']->renderRow();
		}else{
			if(!$actionWf->ferme)
			{
				echo __('The next stakeholder is:') . ' <span id="NomActeur">'. $nomActeur.'</span>';
				echo '<span id="idValideur"></span>'; //Cette span est pour rajouter un input avec l'id du valideur calculé.
			}
		}
		/*
		if($externaliser)
      	{
      		echo $form['prestataire']->renderRow();
			echo '<div id="Presta" style="display: none;">';
			echo $form['prestataire_id']->renderRow();
			echo '<div id="divNomPresta" style="display: none;">';
			echo $form['nom_prestataire']->renderRow();
			echo '</div>';
			echo '</div>';
			echo '<div id="divJustifPresta" style="display: none;">';
			echo $form['justif_prestataire']->renderRow();
			echo '</div>';
      	}
		*/
      	
		?>    	 
		<?php // echo $form['hideConfirmation']->renderRow()?>
		<div class="spacer"></div>
		
		 </fieldset>
		 <?php 
		 	$show = true;
		 	if($templateParams && isset($templateParams['hideButtonsBottom'])){
		 		$show = !$templateParams['hideButtonsBottom'];
		 	}
		 	if($show):?>
	        <div class="buttons">
	          &nbsp;<a href="<?php echo url_for($backurl) ?>"><img title="<?php echo __('Cancel')?>" src="/images/icons/48/back.png"></img></a>
	          <input name="Submit" title="<?php echo __('Apply')?>" type="image" src="/images/icons/48/confirm.png">
	        </div>   
        <?php endif?>
    	 </fieldset>
</form>
<?php if($templateParams && isset($templateParams['showAddParticipant']) && $templateParams['showAddParticipant']):?>
	<fieldset><legend><?php echo __("Other people to be notified")?></legend>
	<a id="addNotif"  onclick="showForm('participant_notifier', 'participants_notifier', 'new');" href="#">
	<img title="<?php echo __('Clic here to add other people');?>" src="/images/icons/16/add_people.png"/></a> <?php echo __('Add other people');?>
	
	<div id ="participants_notifierForm" class="editItemForm" style="display:none"></div>
	<div id ="addparticipant_notifierTarget" class="editItemForm" style="display:none"></div>
	<div id ="list_participants_notifier" class="" >
	</div>
	</fieldset>
<?php endif; ?>
<?php if($addAttach):?>
	<?php  include_partial('attachments/addFilesToForm', array( 'form' => $formAttach)) ?>
<?php endif; ?>



<?php
include_partial('dossiers/showDossier', 
		array('dossier'=>$dossier, 'objDef'=>$objDef,
		'detailObjDef' => $detailObjDef,
		'editbutton'=>false,
		'backbutton'=>false))?>

<?php 
// this template is included to use add_participants form
//cette variable est neccesaire pour le template jsSelectDemandeurClient
// include_partial('jsSelectDemandeurClient', array('form' => $form, 'demandeur' => $demandeur, 'objDef' => $objDef, 'ownerClass' => get_class($demande), 'id_dossier'=>$dossier->id)) ?>

<script type="text/javascript">

function customVal(validators)
{
}
</script>
